<?php

use think\migration\Migrator;
use app\model\CouponOrder;

class AlterCouponOrderChangeProductImgs extends Migrator
{
    public function up()
    {
        $domain = env('app.api_url');
        CouponOrder::where('serv_type', PRODUCT_AROUND_SHOP_SERV)
            ->where('product_image', 'like', '%product_around_travel%')->select()
            ->each(function (CouponOrder $couponOrder) use ($domain){
            $couponOrder->product_image = $domain.'/static/images/home/product_around_travel.png';
            $couponOrder->save();
        });
    }
}
